function valentinesRose2
% 绘制玫瑰花
x=linspace(0,1,300);
theta=linspace(-2*pi,15*pi,300);
[x,theta]=meshgrid(x,theta);
phi=(pi/2).*exp(-theta./8./pi);
X=1-.5.*(1.25.*(1-mod(3.6.*theta,2*pi)./pi).^2-1/4).^2;
y=1.95653.*x.^2.*(1.27689.*x-1).^2.*sin(phi);
r=X.*(x.*sin(phi)+y.*cos(phi));
roseHdl=surf(r.*cos(theta),r.*sin(theta),X.*(x.*cos(phi)-y.*sin(phi)),'EdgeColor','none');

roseHdl.CData=r;
CM=slanCM('copper2');
CM=CM(1:180,:);
colormap(CM)


% 坐标区域修饰
ax=gca;hold on;grid on;
axis([-1,1,-1,1,-.5,1])
ax.FontName='Cambria';
ax.LineWidth=1;
ax.GridLineStyle='-.';
ax.Projection='perspective';
ax.XMinorTick='on';
ax.YMinorTick='on';
ax.ZMinorTick='on';
set(gcf,'Color',[1,1,1]);

% 存储gif =================================================================
% R2022a及之后版本
n=0;
while true
    theta=theta+.01;
    roseHdl.XData=r.*cos(theta);
    roseHdl.YData=r.*sin(theta);
    if n<50
        exportgraphics(gcf,'test1.gif','Append',true)
    end
    n=n+1;
    pause(.01),drawnow
end

% R2022a之前版本
% n=0;DelayTime=.02;
% F=getframe(ax);
% [imind,cm]=rgb2ind(F.cdata,256);
% imwrite(imind,cm,'test2.gif','gif','Loopcount',inf,'DelayTime',DelayTime);
% while true
%     theta=theta+.01;
%     roseHdl.XData=r.*cos(theta);
%     roseHdl.YData=r.*sin(theta);
%     if n<50
%         F=getframe(ax);
%         [imind,cm]=rgb2ind(F.cdata,256);
%         imwrite(imind,cm,'test2.gif','gif','WriteMode','append','DelayTime',DelayTime);
%     end
%     n=n+1;
%     pause(.01),drawnow
% end
end